#!/bin/sh

# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided this notice is
# preserved.  This file is offered as-is, without any warranty.

VERSION=2.0.1
NAME=SDL2_image-$VERSION
ARCHIVE=$NAME.tar.gz

if test ! -e $ARCHIVE
then
    wget -c https://www.libsdl.org/projects/SDL_image/release/$ARCHIVE
fi
if test $? != 0
then
    echo 'Archive not obtained!' 1>&2
    exit 1
fi

if test ! -e $NAME
then
    tar -xf $ARCHIVE
fi
if test $? != 0
then
    echo 'Archive not extracted!' 1>&2
    exit 1
fi

if test -e SDL2_image
then
    rm -rf SDL2_image
fi
mv $NAME/ SDL2_image/
